package cn.clouds234.enumdemo;

import java.lang.reflect.InvocationTargetException;

/**
 * 获取枚举类的所有值
 *
 * @author wyf
 * @date 2023/2/10 17:22
 */
public class Client {
    /**
     * 获取枚举类所有枚举
     * @return tom=1，jerry=2，
     * @param args
     * @user wyf
     * @date 2023/2/10 17:32
     */
    public static void main(String[] args) {
        Class<MyEnum> myEnumClass = MyEnum.class;
        MyEnum[] enumConstants = myEnumClass.getEnumConstants();
        for (MyEnum em : enumConstants) {
            System.out.printf("%s=%s，", em.getName(), em.getCode());

        }
    }
}
